import request from '@/utils/request'

export function getList(params) {
  return request({
    url: `/api/multi-tenancy/tenants`,
    method: 'get',
    params
  })
}

export function getById(id) {
  return request({
    url: `/api/multi-tenancy/tenants/${id}`,
    method: 'get'
  })
}

export function create(dto) {
  return request({
    url: `/api/multi-tenancy/tenants`,
    method: 'post',
    data: dto
  })
}

export function edit(id, dto) {
  return request({
    url: `/api/multi-tenancy/tenants/${id}`,
    method: 'put',
    data: dto
  })
}

export function deleteById(id) {
  return request({
    url: `/api/multi-tenancy/tenants/${id}`,
    method: 'delete'
  })
}

export function getDefaultConnectionString(id) {
  return request({
    url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
    method: 'get'
  })
}

export function editDefaultConnectionString(id, defaultConnectionString) {
  return request({
    url: `/api/multi-tenancy/tenants/${id}/default-connection-string?defaultConnectionString=${defaultConnectionString}`,
    method: 'put'
  })
}

export function deleteDefaultConnectionString(id,) {
  return request({
    url: `/api/multi-tenancy/tenants/${id}/default-connection-string`,
    method: 'delete'
  })
}
